package com.lzhsite.technology.shardingjdbc;

import javax.sql.DataSource;

import com.alibaba.druid.pool.DruidDataSource;

public class Config {
	/**
	 * 创建数据源
	 * 
	 * @param dataSourceName
	 * @return
	 */
	public static DataSource createDataSource(String dataSourceName) {
		DruidDataSource druidDataSource = new DruidDataSource();
		druidDataSource.setDriverClassName(com.mysql.jdbc.Driver.class.getName());
		druidDataSource.setUrl(String.format("jdbc:mysql://localhost:3306/%s", dataSourceName));
		druidDataSource.setUsername("root");
		druidDataSource.setPassword("123456..");
		return druidDataSource;
	}
}
